
/*
 * StubTester.java
 * 
 * Created on Nov 10, 2007, 9:26:43 PM
 * 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bloggerdesktop;
import com.google.gdata.client.*;
//import com.google.gdata.client.calendar.*;
import com.google.gdata.data.*;
import com.google.gdata.data.extensions.*;
import com.google.gdata.util.*;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.Scanner;
/**
 *
 * @author Reimius Forunner
 */
public class StubTester {
    
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        test1GoogleDataHandler();
        System.out.println("First test Successful, it was supposed to fail like that.");
        test2GoogleDataHandler(in);
        System.out.println("Second Test Successful, it was supposed to succeed if you used an actual account.");
    }
    /**
     * This is a test that should not work
     * 
     * */
public static void test1GoogleDataHandler()
{
    GoogleService myService = new GoogleService("blogger", "exampleCo-exampleApp-1");
        try {
            
            myService.setUserCredentials("user@domain.com", "secretPassword");
            
        } catch (AuthenticationException ex) {
            System.out.println("Test Failed");
        }
        GoogleDataHandler gdht = new GoogleDataHandler(myService);
    
}
public static void test2GoogleDataHandler(Scanner in)
{
    String name;
    String pw;
    System.out.println("What is your name?");
    name = in.next();
    System.out.println("What is your password?");
    pw = in.next();
    GoogleService myService = new GoogleService("blogger", "exampleCo-exampleApp-1");
        try {
            
            myService.setUserCredentials(name, pw);
            System.out.println("Phase one: Login Test Successful");
        } catch (AuthenticationException ex) {
            System.out.println("Test Failed");
        }
        GoogleDataHandler gdht = new GoogleDataHandler(myService);
        System.out.println("Phase two: Class Initialization Successful");
        gdht.retrieveBlogs();
        System.out.println("Phase three: Blogs Retrieval Successful");
    
}
}
